home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 438 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. From: clamage@Eng.Sun.COM (Steve Clamage)
  2. Message-ID: <4gi7h0$l0@engnews1.Eng.Sun.COM>
  3. X-Original-Date: 22 Feb 1996 17:01:20 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 22 Feb 96 17:12:15 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: Problem with template overloading.
  9. Organization: Sun Microsystems Inc.
  10. References: <9602220718.AA11584@garlic.spices>
  11. Reply-To: clamage@Eng.Sun.COM
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMSykOuEDnX0m9pzZAQGhDQF/U7ANjJ24i7k24vwryxL3v+tTpG4Ho9aa
  14.     cuesxUVNnG4kLTjDneC8F5Lr0WrUFeFK
  15.     =Zfkj
  16.  
  17. In article AA11584@garlic.spices, wikman@research.nokia.com (Johan Wikman)
  18. writes:
  19.  
  20. >I'd like to be able to have a class and a template with the same name
  21. >in the same scope. 
  22.  
  23.     class A { ... };
  24.  
  25.     template <class T>
  26.     class A {
  27.         void foo() { .... A ... }
  28.     };
  29.  
  30. In A<T>::foo, I use the identifier "A". Does that refer to the template
  31. or to the class? In order not to break all existing code, it must
  32. refer to the template. In that case, how do I refer to the class?
  33. Both things called "A" are in the same scope, and both can be used
  34. where the name of a type is wanted.
  35.  
  36. Perhaps you can think of a special syntax that won't change the meaning
  37. of existing code, or we could say that you can't refer to class A anywhere
  38. in the scope of template A. The question is whether the extra complication
  39. is justified. Remember, you can use longer "official" type or
  40. template names, and add typedefs to make them easier to use.
  41. ---
  42. Steve Clamage, stephen.clamage@eng.sun.com
  43. ---
  44. [ To submit articles: try just posting with your news-reader.
  45.                       If that fails, use mailto:std-c++@ncar.ucar.edu
  46.   FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  47.   Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  48.   Comments? mailto:std-c++-request@ncar.ucar.edu.
  49. ]
  50.